See code here.
## Precision & Recall
# compute the average precision and sd
results <- list(res_ccd5psparse, res_fci5psparse, res_cci5psparse, res_ccd10psparse, res_fci10psparse, res_cci10psparse, res_ccd5pdense, res_fci5pdense, res_cci5pdense, res_ccd10pdense, res_fci10pdense, res_cci10pdense, res_ccd5pLVsparse, res_fci5pLVsparse, res_cci5pLVsparse, res_ccd5pLVdense, res_fci5pLVdense, res_cci5pLVdense, res_ccd10pLVsparse, res_fci10pLVsparse, res_cci10pLVsparse, res_ccd10pdense, res_fci10pLVdense, res_cci10pLVdense) %>%
# transpose df
map(~ sjmisc::rotate_df(.x) %>%
# add sample size (N) info
rename_with(~paste0(.x, "N = ", rep(N, each=8))) %>%
# think about how to deal with NAs or do I want to define sth. else instead of NAs.
#na.omit(.x) %>%
summarise(across(everything(.), list(mean = ~mean(., na.rm=T), sd = ~sd(., na.rm=T))))) %>%
bind_rows() %>%
mutate(algorithm = rep(c("ccd", "fci", "cci"), 8),
condition = rep(c("5p_sparse", "10p_sparse", "5p_dense", "10p_dense", "5p_LVsparse", "5p_LVdense", "10p_LVsparse", "10p_LVdense"), each=3)) %>%
# brings the algorithm and condition names first
relocate(where(is.character), .before = where(is.numeric)) %>%
# convert itto a long format
tidyr::pivot_longer(!c(algorithm, condition), names_to = "metric", values_to = "value") %>%
# Add sample size column (N) & clean up the column name
mutate(N = stringr::str_extract(metric, "(?<=[N =])\\d+"),
metric = stringr::str_replace_all(metric, "[0-9.]+|[N =]", ""))
## Uncertainty
uncertainties <- bind_rows("ccd_5p-sparse" = uncer_ccd5psparse, "fci_5p-sparse" = uncer_fci5psparse, "cci_5p-sparse"=uncer_cci5psparse, "ccd_10p-sparse"=uncer_ccd10psparse, "fci_10p-sparse" = uncer_fci10psparse, "cci_10p-sparse" = uncer_cci10psparse, "ccd_5p-dense"=uncer_ccd5pdense, "fci_5p-dense"=uncer_fci5pdense, "cci_5p-dense"=uncer_cci5pdense, "ccd_10p-dense"=uncer_ccd10pdense, "fci_10p-dense"=uncer_fci10pdense, "cci_10p-dense"=uncer_cci10pdense, "ccd_5p-LVsparse"=uncer_ccd5pLVsparse, "fci_5p-LVsparse"=uncer_fci5pLVsparse, "cci_5p-LVsparse"=uncer_cci5pLVsparse, "ccd_10p-LVsparse"=uncer_ccd10pLVsparse, "fci_10p-LVsparse"=uncer_fci10pLVsparse, "cci_10p-LVsparse"=uncer_cci10pLVsparse,
"ccd_5p-LVdense"=uncer_ccd5pLVdense, "fci_5p-LVdense"=uncer_fci5pLVdense, "cci_5p-LVdense"=uncer_cci5pLVdense, "ccd_10p-LVdense"=uncer_ccd10pLVdense, "fci_10p-LVdense"=uncer_fci10pLVdense, "cci_10p-LVdense"=uncer_cci10pLVdense,.id="id") %>%
group_by(id) %>%
summarise_all(list(mean = mean, sd = sd)) %>%
mutate(algorithm = stringr::str_split(id, "_", simplify = T)[,1],
condition = stringr::str_split(id, "_", simplify = T)[,2]) %>%
tidyr::pivot_longer(!c(algorithm, condition, id), names_to = "name", values_to = "value") %>%
mutate(N = stringr::str_extract(stringr::str_split(name, "_", simplify = T)[,1], "(\\d)+"),
statistics = stringr::str_split(name, "_", simplify = T)[,2]) %>%
dplyr::select(-id, -name) %>% relocate(where(is.character), .before = where(is.numeric))
## SHD
SHDs <- bind_rows("ccd_5p-sparse" = SHD_ccd5psparse, "fci_5p-sparse" = SHD_fci5psparse, "cci_5p-sparse"=SHD_cci5psparse, "ccd_10p-sparse"= SHD_ccd10psparse, "fci_10p-sparse" = SHD_fci10psparse, "cci_10p-sparse" = SHD_cci10psparse, "ccd_5p-dense"= SHD_ccd5pdense, "fci_5p-dense"=SHD_fci5pdense, "cci_5p-dense"=SHD_cci5pdense, "ccd_10p-dense"= SHD_ccd10pdense, "fci_10p-dense"=SHD_fci10pdense, "cci_10p-dense"=SHD_cci10pdense, "ccd_5p-LVsparse"=SHD_ccd5pLVsparse, "fci_5p-LVsparse"=SHD_fci5pLVsparse, "cci_5p-LVsparse"=SHD_cci5pLVsparse, "ccd_10p-LVsparse"=SHD_ccd10pLVsparse, "fci_10p-LVsparse"=SHD_fci10pLVsparse, "cci_10p-LVsparse"=SHD_cci10pLVsparse,
"ccd_5p-LVdense"=SHD_ccd5pLVdense, "fci_5p-LVdense"=SHD_fci5pLVdense, "cci_5p-LVdense"=SHD_cci5pLVdense, "ccd_10p-LVdense"=SHD_ccd10pLVdense, "fci_10p-LVdense"=SHD_fci10pLVdense, "cci_10p-LVdense"=SHD_cci10pLVdense, .id="id") %>%
group_by(id) %>%
summarise_all(list(mean = mean, sd = sd)) %>%
mutate(algorithm = stringr::str_split(id, "_", simplify = T)[,1],
condition = stringr::str_split(id, "_", simplify = T)[,2]) %>%
tidyr::pivot_longer(!c(algorithm, condition, id), names_to = "name", values_to = "value") %>%
mutate(N = stringr::str_extract(stringr::str_split(name, "_", simplify = T)[,1], "(\\d)+"),
statistics = stringr::str_split(name, "_", simplify = T)[,2]) %>%
dplyr::select(-id, -name) %>% relocate(where(is.character), .before = where(is.numeric))